package com.crm.business.crm.mapper;


import com.crm.common.crm.common.CrmModel;
import com.crm.common.crm.entity.BO.CrmDataCheckBO;
import com.crm.common.crm.entity.PO.CrmContacts;
import com.crm.common.crm.entity.VO.CrmDataCheckVO;
import com.crm.common.crm.entity.VO.CrmInfoNumVO;
import com.crm.common.ka.core.entity.BasePage;
import com.crm.business.servlet.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 联系人表 Mapper 接口
 * </p>
 *
 * @author zhangzhiwei
 * @since 2020-05-26
 */
public interface CrmContactsMapper extends BaseMapper<CrmContacts> {

    /**
     * 通过id查询联系人数据
     *
     * @param id id
     * @param userId 用户ID
     * @return data
     */
    public CrmModel queryById(@Param("id") Integer id, @Param("userId") Long userId);

    /**
     * 查询详情页数量
     * @param map map
     */
    public CrmInfoNumVO queryNum(Map<String, Object> map);

    BasePage<Map<String, Object>> queryBusiness(BasePage<Object> parse, @Param("contactsId") Integer contactsId);

    @Select("select city_name from bill_crm_area where parent_id = #{id}")
    public List<String> queryCityList(@Param("id") Integer id);

    List<CrmDataCheckVO> dataCheck(@Param("data") CrmDataCheckBO dataCheckBO);

    /**
     * 根据客户Id查询联系人信息
     * @param customerId 客户Id
     * @return
     */
    CrmContacts getContactsByCustomerId(@Param("customerId") Integer customerId);

    Integer queryContactsIdBySerialNumber(@Param("serialNumber") String serialNumber);
}
